package com.web.cheng.controller;

import com.common.cheng.enmus.RequestCode;
import com.common.cheng.entities.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@Api("管理员服务测试接口")
@RequestMapping("/test")
public class TestController {

    @ApiOperation("测试")
    @GetMapping("/test")
    @ApiImplicitParam(paramType = "query", name = "name", value = "姓名", required = true, dataType = "String")
    public Result<?> test(String name){
        if (!name.equals("蒙水")){
            return Result.error(RequestCode.BAD_REQUEST.getCode(),"只能发送蒙水");
        }
        HashMap<String, String> hm = new HashMap<>();
        hm.put("cheng",name);
        return Result.success(hm);
    }
}
